@file:Suppress("UNUSED_PARAMETER")

package dev.entao.travel.model

import dev.entao.base.HideClient
import dev.entao.base.Label
import dev.entao.base.MaxLength
import dev.entao.base.NullValue
import dev.entao.page.OptionList
import dev.entao.sql.*
import java.sql.Timestamp

@Label("管理账号")
class Account : Model() {

    @Label("ID")
    @PrimaryKey
    @AutoInc
    var id: Int by model

    @Label("手机号")
    @Unique
    @MaxLength(32)
    var phone: String by model

    @HideClient
    @Label("密码")
    @MaxLength(256)
    var pwd: String by model

    @Label("姓名")
    @MaxLength(128)
    var name: String by model

    @Index
    @OptionList("1:系统管理员", "2:商城管理员", "3:商家管理员", "4:机构分销管理员")
    @Label("类型")
    var level: Int by model

    @Index
    @NullValue("0")
    @Label("状态")
    @OptionList("0:正常", "1:禁用")
    var status: Int by model

    @Label("最后登录")
    var lastLogin: Timestamp? by model


    companion object : ModelClass<Account>() {
        const val ST_ENABLE = 0
        const val ST_DISABLE = 1

        const val LEVEL_SYS = 1
        const val LEVEL_MALL = 2
        const val LEVEL_MERCHANT = 3
        const val LEVEL_CHANNEL = 4

    }
}